package dao.search;

import util.C3p0Util;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class MoneyMessageSearchDao {
    public int allMoney(){

        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        int count = 0;

        String sql = "select count(gm_acmoney) from t_giveMoney";


        try {

            conn = C3p0Util.getConnection();
            ps = conn.prepareStatement(sql);
            rs = ps.executeQuery();
            if (rs.next()) {
                count = rs.getInt(1);
                //System.out.println("已缴费用为：" + count*500);
            }

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return count*150;
    }

    public int readyMoney(){

        Connection conn = null;
        PreparedStatement ps = null;
        ResultSet rs = null;
        int count = 0;

        String sql = "select count(gm_gimoney) from t_giveMoney";


        try {

            conn = C3p0Util.getConnection();
            ps = conn.prepareStatement(sql);
            rs = ps.executeQuery();
            if (rs.next()) {
                count = rs.getInt(1);
                //System.out.println("已缴费用为：" + count*500);
            }

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return count;
    }
}
